package com.jlpay.openapi.demo.ledger.merchconf;

import com.jlpay.open.jlpay.sdk.java.model.ledger.request.MerchRevOpenRequest;
import com.jlpay.open.jlpay.sdk.java.model.ledger.response.MerchRevOpenResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/8/30
 **/
public class MerchRevOpenService {

    private static final Logger LOGGER = LoggerFactory.getLogger(MerchRevOpenService.class);

    public static void main(String[] args) {
        MerchRevOpenRequest merchRevOpenRequest = buildMerchRevOpenRequest();
        MerchRevOpenResponse merchRevOpenResponse = JlpayOpenApiService.openMerchService()
                .post(merchRevOpenRequest, MerchRevOpenResponse.class);
        LOGGER.info("分账配置入账方注册响应:{}", JsonUtils.toString(merchRevOpenResponse));
    }

    private static MerchRevOpenRequest buildMerchRevOpenRequest() {
        MerchRevOpenRequest merchRevOpenRequest = new MerchRevOpenRequest();
        merchRevOpenRequest.setOrgCode("50720711");
        merchRevOpenRequest.setMchId("849581183510017");
        merchRevOpenRequest.setMerchType("1");
        merchRevOpenRequest.setLicenseNumber("91330108MAB555NP6U");
        merchRevOpenRequest.setLicenseName("深圳市泰思能源有限公司");
        merchRevOpenRequest.setLicenseAddress("深圳市南山区科技南路105号");
        merchRevOpenRequest.setLicenseBeginDate("2024-01-01");
        merchRevOpenRequest.setLicenseEndDate("2024-02-01");
        merchRevOpenRequest.setLicenseFrontSourceId("jlpay/2024-08-30/e22bc590f4131418483626fded04f3362.png");
        merchRevOpenRequest.setLegalName("张三");
        merchRevOpenRequest.setLegalNumber("替换为身份证");
        merchRevOpenRequest.setLegalBeginDate("2024-01-01");
        merchRevOpenRequest.setLegalEndDate("2025-01-01");
        merchRevOpenRequest.setLegalFrontSourceId("jlpay/2024-08-30/e22bc590f433412131326fded04f3362.png");
        merchRevOpenRequest.setLegalBackSourceId("jlpay/2024-08-30/e22bc590f4311418483626fded04f3362.png");
        merchRevOpenRequest.setMobile("136****0349");
        merchRevOpenRequest.setBankCardNo("6226****1663");
        merchRevOpenRequest.setBankCardName("张三");
        merchRevOpenRequest.setBankCode("308");
        merchRevOpenRequest.setBankName("中国建设银行股份有限公司");
        merchRevOpenRequest.setBankBranchCode("105584000370");
        merchRevOpenRequest.setBankBranchName("中国建设银行股份有限公司深圳罗湖支行");
        merchRevOpenRequest.setBankFrontSourceId("jlpay/2024-08-30/e22bc590f4131418483626fded04f3362.png");
        return merchRevOpenRequest;
    }
}
